let container = document.querySelector('.container')
function render(data, el) {
    console.log(data, el)
    data.forEach(item => {
        let li = document.createElement('li');
        let regExp = /(?<=imgurl=)[^'"]*/
        let result = item.productImg2.match(regExp)
        let domStr = `
             <img width="100" productid="${item.productId}" src=${result[0]} alt="">
             <div productid="${item.productId}">
             <h4 productid="${item.productId}">${item.productName}</h4>
             
             <span productid="${item.productId}">${item.productFrom}丨${item.productTime}</span>
                <i productid="${item.productId}">${item.productComCount}</i>
                </div>`

        li.innerHTML = domStr;

        el.appendChild(li)
    })
}
function getData(pageid = 0) {
    fetch(`http://chst.vip:1234/api/getmoneyctrl?pageid=${pageid}`)
        .then(body => body.json())
        .then(res => {
            console.log(res)
            render(res.result, container)
        })
}
getData()
let pageid = 1;
lazyLoad(function () {
    pageid++
    if (pageid > 14) {

        return
    }
    getData(pageid)
}, 100)
//let uu = $('.container').get(0)

container.onclick = function (e) {
    if (e.target) {
        let _this = e.target;
        let id = _this.getAttribute('productid')
        console.log(id)
        location.href = "./sqklist.html?productid=" + id
    }
}
/* $('.container').on('click','li',function(){
    location.href='./sqklist.html?id='

}) */

